Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

itrace.py: fix invalid escape sequences #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mkannwischer
Copy link
Contributor

When running itrace, I get various warning due to missing raw (r) markers in regex patterns.

/home/mjk/git/cryptoline/scripts/itrace.py:87: SyntaxWarning: invalid escape sequence '\('
  '\(''%([a-z0-9]+)'
/home/mjk/git/cryptoline/scripts/itrace.py:89: SyntaxWarning: invalid escape sequence '\)'
  '([1248]))?''\)'
/home/mjk/git/cryptoline/scripts/itrace.py:90: SyntaxWarning: invalid escape sequence '\s'
  '(?:\s*,\s*%([a-z0-9]+))?')
/home/mjk/git/cryptoline/scripts/itrace.py:131: SyntaxWarning: invalid escape sequence '\s'
  '(?:\s*,\s*(x[0-9]+|#-?(?:0x)?[0-9a-fA-F]+))?''\]'
/home/mjk/git/cryptoline/scripts/itrace.py:131: SyntaxWarning: invalid escape sequence '\]'
  '(?:\s*,\s*(x[0-9]+|#-?(?:0x)?[0-9a-fA-F]+))?''\]'
/home/mjk/git/cryptoline/scripts/itrace.py:132: SyntaxWarning: invalid escape sequence '\s'
  '(?:\s*,\s*#(-?(?:0x)?[0-9a-fA-F]+))?')
/home/mjk/git/cryptoline/scripts/itrace.py:174: SyntaxWarning: invalid escape sequence '\s'
  '(?:\s*,\s*([a-z0-9]+|#-?(?:0x)?[0-9a-fA-F]+)|\s*:\d+)?''\]'
/home/mjk/git/cryptoline/scripts/itrace.py:174: SyntaxWarning: invalid escape sequence '\]'
  '(?:\s*,\s*([a-z0-9]+|#-?(?:0x)?[0-9a-fA-F]+)|\s*:\d+)?''\]'
/home/mjk/git/cryptoline/scripts/itrace.py:175: SyntaxWarning: invalid escape sequence '\w'
  '|(?:ld|st)m\w*\.?\w*\s+(\w+)!?,)')
/home/mjk/git/cryptoline/scripts/itrace.py:384: SyntaxWarning: invalid escape sequence '\s'
  value = re.match('0x[0-9a-fA-F]+\s*<?.*>?\s*:\s+(0x[0-9a-fA-F]+)', value).group(1)
> /home/mjk/git/cryptoline/scripts/itrace.py(342)<module>()
-> def debug(msg):
$ python3 --version
Python 3.12.3

The behaviour got changed in Python 3.6 and 3.12: https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals.

Changed in version 3.6: Unrecognized escape sequences produce a [DeprecationWarning](https://docs.python.org/3/library/exceptions.html#DeprecationWarning).

Changed in version 3.12: Unrecognized escape sequences produce a [SyntaxWarning](https://docs.python.org/3/library/exceptions.html#SyntaxWarning). In a future Python version they will be eventually a [SyntaxError](https://docs.python.org/3/library/exceptions.html#SyntaxError).

This will eventually be an error, so it is better to fix it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant